//////////////////////////////////////////////////////////////////////////////////////////////////////////// // // //---------------------------- Ebrahim Foulaadvand, 05 Aug 2013 ----------------- // // // // The routine "SchroFTCS" solves the 1D Schrodinger wave equation using forward time centered space // // scheme. Periodic boundary condition is used. The system length L and we take hbar=m=1. // // Initial wave shape is cosine-modulated Gaussian pulse. // // // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////// #include #include #include #include #include #include #include #include #include #include using namespace std; main() { double hbar=1,m=1,tau=0.005,h,L=40,sigma0=0.05,k0=0.2,x,x0=0,p0=hbar*(k0/m), taw=2*m*sigma0*sigma0/hbar; int N=200,i,n,T=1000; ofstream file0 ("initial profile n=0.plt"); //output file for the probability profile at timestep n=0. ofstream file1 ("probability FTCS n=10.plt"); //output file for the probability profile at timestep n=1. ofstream file2 ("probability FTCS n=20.plt"); //output file for the probability profile at timestep n=2. ofstream file3 ("probability anal n=10.plt"); //output file for theabalytic at timestep n=1. ofstream file4 ("probability anal n=20.plt"); //output file for theabalytic at timestep n=1. vector PsiR(N+1,0),PsiRnew(N+1,0),PsiI(N+1,0),PsiInew(N+1,0),Probanal(N+1,0),V(N+1,0); // Arrays "PsiR" and "PsiI" store the current values of the real and imaginary parts of the wavefunction. // Arrays "PsiRnew", "PsiInew" store the updated values of the real and imaginary parts of the wavefunction. h=L/N; cout<<"h= "<